package com.cuicuisha.gxyp.manager.controller;

import com.cuicuisha.gxyp.manager.service.FileUploadService;
import com.cuicuisha.gxyp.model.vo.common.Result;
import com.cuicuisha.gxyp.model.vo.common.ResultCodeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * ClassName: FileUploadController
 * Description:
 *
 * @Author 脆脆鲨
 * @Create 2024-09-13 14:18
 * @Version 1.0
 */
@RestController
@CrossOrigin(allowCredentials = "true" , originPatterns = "*" , allowedHeaders = "*")
@RequestMapping("/admin/system")
public class FileUploadController {
    @Autowired
    private FileUploadService fileUploadService;

    @PostMapping("/fileUpload")
    public Result<String> fileUploadService(@RequestParam("file") MultipartFile file) throws IOException {
        return Result.build(fileUploadService.fileUpload(file), ResultCodeEnum.SUCCESS);
    }
}
